import React from 'react';
import { Toast, } from 'antd-mobile';

export default class Index extends React.Component {
    constructor(props){
        super(props)
        this.state={
            data: [],
            get_num: 0,
        }
    }
	componentDidMount(){
        document.title = '勋章'
        global.Ajax.hhtc_request("medal/medalType",{}).then(data=>{
			if(data.code===1){
                this.setState({
                    data: data.data.data,
                    get_num: data.data.get_num
                })
            }
		})
	}
	render(){
		return(
			<div className='xz_list_box'>
                <img alt='' src={require('../../imgs/xzbg.png')} className='xzbg' />
                <div className='sum'>
                    <h1>我的勋章</h1>
                    <p>已获得{this.state.get_num}枚</p>
                </div>
                <p className='xztitle'>成就勋章</p>
                <div className='list'>
                    {this.state.data.map((item,index)=>{
                        return(
                            <div key={'list'+index} onClick={()=>{this.props.history.push('/page/home/user/medaldetail/'+item.id)}}>
                                <img alt='' src={item.icon} />
                                <p>{item.name}</p>
                            </div>
                        )
                    })}
                </div>
			</div>
		)
	}
}
